package com.chaihu.jpaDemo.modules.system.entity;


import com.chaihu.jpaDemo.modules.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;


/**
 * 描述: 测试用户
 * 作者: qinzhw
 * 创建时间: 2018/8/8 9:47
 */
@ApiModel
@Entity
@Table(name = "sys_user")
@org.hibernate.annotations.Table(appliesTo = "sys_user",comment="用户表")
@Data
public class User extends BaseEntity {
	
	private static final long serialVersionUID = -1703630040908311405L;
	
    @NotBlank(message="学号不能为空")
	@ApiModelProperty("学号/账号/编号")
	@Column(unique=true,columnDefinition = "varchar(100) comment '学号/账号/编号'")
	private String account;
    
    @NotNull(message="密码不能为空")
	@ApiModelProperty("密码")
	@Column(columnDefinition = "varchar(100) comment '密码'")
    private String password;
    
    @NotBlank(message="姓名不能为空")
    @ApiModelProperty("姓名")
	@Column(columnDefinition = "varchar(100) comment '姓名'")
    private String name;
    
    @NotNull(message="性别不能为空")
    @ApiModelProperty("性别")
	@Column(columnDefinition = "int(1) comment '性别'")
    private Integer sex;
    
    @NotNull(message="角色不能为空")
    @ApiModelProperty("角色")
	@Column(columnDefinition = "int(2) comment '角色'")
    private Integer role;

    @ApiModelProperty("出生日期")
	@Column(columnDefinition = "date comment '出生日期'")
    private Date birthdate;
    
    @NotNull(message="是否有效不能为空")
	@ApiModelProperty("用户是否有效:0=无效,1=有效")
    @Column(columnDefinition="int(2) default 1 comment '用户是否有效:0=无效,1=有效'",nullable=false)
    private Integer isEnabled = 0;

	@ApiModelProperty("班级名")
	@Column(columnDefinition = "varchar(100) comment '班级名'")
    private String className;
	
	@ApiModelProperty("课程教师名称")
	@Column(columnDefinition = "varchar(100) comment '课程教师名称'")
	private String teacherName;
	
	@ApiModelProperty("课程老师学号/账号/编号")
	@Column(columnDefinition = "varchar(100) comment '课程老师学号/账号/编号'")
	private String teacherAccount;
	
	@ApiModelProperty("学年")
	@Column(columnDefinition = "int(4) comment '学年'")
	private Integer studyYear;

    
}
